<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="contain">
        <!-- <h2>祝福冬奥</h2> -->
        <ul class="gameList">
            <li> 1贝克汉姆：衷心希望北京能够申办成功！</li>
            <li> 2姚明：北京申冬奥是个非常棒的机会！加油！</li>
            <li> 3张虹：北京办冬奥，大家的热情定超乎想象！ </li>
            <li> 4肖恩怀特：我爱北京，支持北京申办冬奥会！</li>
        </ul>
    </div>
</body>
<script src="../js/jq-1.12.4.js"></script>
<script>
    $(function () {
        setInterval(function () {
            let li = $(".gameList>li:first")
            let marginTop = parseInt(li.css("margin-top")) //获取li的margin-top值
            marginTop--
            console.log(marginTop);
            li.css("margin-top", marginTop + "px")
            if (marginTop < -40) {
                li.css("margin-top", "0px")
                $(".gameList").append(li)
            }
        }, 50)
    })
</script>

</html>